-
Notifications
You must be signed in to change notification settings - Fork 587
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tests/lib/fakestore: add support for tracking channels #14840
tests/lib/fakestore: add support for tracking channels #14840
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I think adding a test here for the channel functionality would be good.
tests/lib/fakestore/store/store.go
Outdated
@@ -447,6 +467,18 @@ func (s *Store) collectSnaps(bs asserts.Backstore) (map[string]*revisionSet, err | |||
|
|||
snaps[info.Name].add(snap.R(info.Revision), fn) | |||
|
|||
digest, _, err := asserts.SnapFileSHA3_384(fn) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The above info
already carries the digest.
return nil, err | ||
} | ||
} else { | ||
sc := bufio.NewScanner(fd) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing a defer fd.Close()
in here.
780172b
to
49be6de
Compare
tests/lib/fakestore/store/store.go
Outdated
@@ -179,7 +197,9 @@ type essentialInfo struct { | |||
Base string | |||
} | |||
|
|||
func snapEssentialInfo(fn, snapID string, bs asserts.Backstore) (*essentialInfo, error) { | |||
var errInfo = errors.New("cannot get info") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what this is. I have to remove it.
d696fb0
to
710aced
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #14840 +/- ##
==========================================
+ Coverage 78.20% 78.27% +0.06%
==========================================
Files 1151 1154 +3
Lines 151396 152356 +960
==========================================
+ Hits 118402 119258 +856
- Misses 25662 25731 +69
- Partials 7332 7367 +35
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
dgst, _, err := asserts.SnapFileSHA3_384(snapFn) | ||
c.Assert(err, IsNil) | ||
|
||
f, err := os.OpenFile(filepath.Join(s.store.blobDir, "channels", dgst), os.O_CREATE|os.O_WRONLY, 0644) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing a f.Close
here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks
ac4ca39
to
d076339
Compare
d076339
to
4b8fe5d
Compare
4b8fe5d
to
f8c78ca
Compare
This is an updated to the fake store, and none of the failing tests use the fake store.
|
Cherry-pick of eb2a956 from #14305 in
fde-manager-features
branch.